package edu.thu.studio.ormdesigner.common;

import org.eclipse.gef.commands.Command;

import edu.thu.studio.ormdesigner.util.Utils;

public abstract class AbstractCommand extends Command {
    
    /**
     * {@inheritDoc}
     */
    @Override
    final public void execute() {
        try {
            doExecute();
            
        } catch (Exception e) {
            Utils.showExceptionDialog(e);
        }
    }
    
    /**
     * {@inheritDoc}
     */
    @Override
    final public void undo() {
        try {
            doUndo();
        } catch (Exception e) {
            Utils.showExceptionDialog(e);
        }
    }
    
    abstract protected void doExecute();
    
    abstract protected void doUndo();
}
